import re

# file=open("sex.txt",mode="w")#开启一个txt文档
txt = open(r"C:\Users\patrickjane\Desktop\chromehistoryview\111.txt", "r", encoding='utf-16').read()  #txt编码格式不是utf-8而是utf-16

result=""
test_text = re.findall("..............+html", txt)#取出每行含有pass的文本
result = result +'\n'.join(test_text)#换行输出


# file.write(result)#写入
# print(result)
# print(type(result))


"""import xlsxwriter

workbook = xlsxwriter.Workbook('sex1.xlsx') # 建立文件

worksheet = workbook.add_worksheet() # 建立sheet， 可以work.add_worksheet('employee')来指定sheet名，但中文名会报UnicodeDecodeErro的错误
title = [U'名称',U'副标题']     #表格title
worksheet.write_row('A1',title)  #title 写入Excel
for i in range(1,100):
    num0 = bytes(i+1)
    num = bytes(i)
    row = 'A' + num0
    data = [u'学生'+num,num,]
    worksheet.write_row(row, data)
    i+=1

workbook.close()
"""













